All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.apple.alpha.core.Range

java.lang.Object
   |
   +----com.apple.alpha.core.Range

public final class Range
extends Object
This class is used to represent a range. A range has two attributes, its location (or start) and length (or extent).


Variable Index

 o length
The length (or extent) of the range.
 o location
The start of the range.

Constructor Index

 o Range(int, int)
Create a new Range with the given location and length.

Method Index

 o equals(Object)
Compare an Object to the receiver.
 o intersectionRange(Range)
Return a new Range covering the intersection of the receiver and the given Range.
 o isEqualToRange(Range)
Compare a Range to the receiver.
 o locationInRange(int)
Return true if the given location is included in the receiving Range.
 o maxRange()
Return the farther location covered by the Range.
 o toString()
Return a textual representation of the receiver.
 o unionRange(Range)
Return a new Range covering the union of the receiver and the given Range.

Variables

 o location
 public int location
The start of the range.

 o length
 public int length
The length (or extent) of the range.

Constructors

 o Range
 public Range(int loc,
              int len)
Create a new Range with the given location and length.

Parameters:
loc - the location of the new range.
len - the length of the new range.

Methods

 o maxRange
 public int maxRange()
Return the farther location covered by the Range.

 o locationInRange
 public boolean locationInRange(int loc)
Return true if the given location is included in the receiving Range.

Parameters:
loc - the location to be tested.
 o equals
 public boolean equals(Object o)
Compare an Object to the receiver. Return true if the Object is an instance of the Range class and both objects have the same location and length.

Parameters:
o - the object the receiver is compared against.
Overrides:
equals in class Object
 o isEqualToRange
 public boolean isEqualToRange(Range r)
Compare a Range to the receiver. Return true if both objects have the same location and length.

Parameters:
r - the Range the receiver is compared against.
 o unionRange
 public Range unionRange(Range r)
Return a new Range covering the union of the receiver and the given Range. This new Range covers all indices in and between the receiver and the given Range. If one range is completely contained in the other, the returned range is is equal to the larger range.

Parameters:
r - the Range used to create the union.
 o intersectionRange
 public Range intersectionRange(Range r)
Return a new Range covering the intersection of the receiver and the given Range. This new Range covers the indices that exist in both ranges. If the returned range's length field is zero, then the two ranges don't intersect, and the value of the location field is undefined

Parameters:
r - the Range used to create the union.
 o toString
 public String toString()
Return a textual representation of the receiver. A point with location 7 and length 19 will be represented as the string "{location = 7; length = 19}".

Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index